package com.card.main;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import com.xiaoao.net.global.Global;

public class MainServlet extends HttpServlet{
	
	@Override
	public void init() throws ServletException {
//		System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
//        System.setProperty("AsyncLogger.ExceptionHandler", "com.xiaoao.fsgame.server.util.LogExceptionHandler");
//        SignalHandler handler = new SignalHandler() {
//            @Override
//            /**
//             * do nothing
//             */
//            public final void handle(Signal sig) {
//            }
//        };
//
//        Signal.handle(new Signal("INT"), handler);
//        Thread scan = new Thread(new ScanRunner(new MainApp()), "Scanner");
//        Runtime.getRuntime().addShutdownHook(ShutdownHook.getInstance());
//        scan.start();
		System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
        System.setProperty("AsyncLogger.ExceptionHandler", "com.xiaoao.net.utils.LogExceptionHandler");
//        new Thread(){
//
//			@Override
//			public void run() {
//			}
//        	
//        }.start();
        
        long start = System.currentTimeMillis();
		new MainApp().initServer();
		Global.logSysMessage("-------------------------------------------------------------------");
        Global.logSysMessage("HLKJ2222服务器启动完成，用时" + (System.currentTimeMillis() - start) + "ms");
        Global.logSysMessage("-------------------------------------------------------------------");
	}

	@Override
	public void destroy() {
		System.err.println("关闭服务器！!!!!!!");
	}
	
	
}
